﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataAccessLayer
{
    public class GuestRepository : Repository<Guest>
    {
        public override Guest FindById(int id)
        {
            return _context.Guests.SingleOrDefault(o => o.ID == id);
        }

        public IEnumerable<Guest> FindByBookingId(int id)
        {
            IEnumerable<Guest> guest = from guests in _context.Guests
                                       join bookingguest in _context.BookingGuests on guests.ID equals bookingguest.GuestID
                                       where bookingguest.BookingID == id
                                       select guests; 

            
            return guest;
        }
    }
}
